//
//  ViewController.m
//  TestCrash
//
//  Created by CityDo on 2019/4/17.
//  Copyright © 2019 CityDo. All rights reserved.
//

#import "ViewController.h"
#import "CityDOCatchCrash.h"
#import "BSBacktraceLogger.h"
#include <libkern/OSAtomic.h>
#include <execinfo.h>
#import "HelperUtil.h"
#import "JDDeviceUtils.h"
#import "UIDevice+CityDOFCUUID.h"
#import "CityDOCatchCrashVC.h"
#import "CityDOCrashConfig.h"
#import "TestSDK.h"

#import "NSDictionary+log.h"

#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"%s\n",[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(...)
#endif




@interface ViewController ()
@property (strong, nonatomic) NSString * userId;
@property (strong, nonatomic) CityDOCatchCrashVC *cityDOCatchCrashVC;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
 
    CityDOCrashConfig *config = [[CityDOCrashConfig alloc]init];
    
    config.logInfoURL = @"http://172.16.16.77:8071/crashmgmt/api/breakinfo/uploadLogs";
    config.crashInfoURL = @"http://172.16.16.77:8071/crashmgmt/api/breakinfo/insert";
    config.collectLogInfoEnable = YES;
    config.collectCrashInfoEnable = YES;

    self.cityDOCatchCrashVC = [CityDOCatchCrashVC CityDOCatchStartWithAppId:@"00000" config:config];
    [CityDOCatchCrashVC postExceptionMessage];
    
}

- (IBAction)clickMe:(id)sender {
    
    NSString *nilStr = nil;
    NSString *nilStr1 = nil;
    NSArray *array = @[@"chenfanfang", nilStr];
    
 //    NSLog(@"callStackSymbols－－－%@",[NSThread callStackSymbols]);
//这次非正式的发生；的发生地方；沈德符
    
}





//#pragma mark -- 发送崩溃日志
//- (void)sendExceptionLogWithData:(NSData *)data path:(NSString *)path {
//
//    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//    manager.requestSerializer.timeoutInterval = 5.0f;
//    //告诉AFN，支持接受 text/xml 的数据
//    [AFJSONResponseSerializer serializer].acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
//    NSString *urlString = @"后台地址";
//
//    [manager POST:urlString parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
//        [formData appendPartWithFileData:data name:@"file" fileName:@"Exception.txt" mimeType:@"txt"];
//    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
//        // 删除文件
//        NSFileManager *fileManger = [NSFileManager defaultManager];
//        [fileManger removeItemAtPath:path error:nil];
//
//    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
//
//
//    }];
//
//}


@end
